﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace GW2_Marketeer__WPF_
{
    public class ShoppingItem : INotifyPropertyChanged
    {
        public string Name { get; set; }
        public int AHPrice { get; set; }
        public int Quantity { get; set; }
        private int _totalCost;
        public int TotalCost
        {
            get
            {
                if (_totalCost == 0)
                    _totalCost = AHPrice * Quantity;

                return _totalCost;
            }
            set
            {
                _totalCost = value;
            }
        }

        #region INotifyPropertyChanged
        
        public event PropertyChangedEventHandler PropertyChanged;
        public void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        #endregion
    }
}
